<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">

<head>
    <title>啄木鸟管理平台</title>
    <th:block th:replace="common/common :: jscss"/>
    <th:block th:replace="common/common :: menucss"/>
    <script th:src="${ZMN_URL_ENV}+'res.xiujiadian.com/static/js/plugins/gwm/gwm.min.js?v=1.0'"></script>
    <style>
        /*layer弹窗按钮颜色统一皮肤*/
        .my-skin .layui-layer-btn a {
            background-color: dodgerblue;
            border: 1px solid dodgerblue;
            color: #FFF;
        }
    </style>
    <style>
        .title-border {
            display: inline-block;
            border-left: 3px solid #009688;
            height: 1em;
            margin-right: 10px;
        }

        .content-header {
            color: #333;
        }

        .content-body {
            color: #888888;
            font-size: .9em;
        }

        /* 第一行 */
        .first-row > div {
            min-height: 440px;
        }

        .news-item {
            border-bottom: 5px solid white;
            padding: 10px 0;
        }

        .news-item:last-child {
            border: none;
        }

        .news-red {
            color: red;
        }

        /* 第2行 */
        .second-row > div {
            min-height: 380px;
        }

    </style>
</head>
<body class="layui-layout-body">

<div id="zmn_app">
    <div class="layui-layout layui-layout-admin">

        <input id="initialPassword" name="initialPassword" th:value="${initialPassword}">

        <!-- 头部区域 -->
        <div class="layui-header">

            <!-- 左侧 -->
            <ul class="layui-nav layui-layout-left">
                <li class="layui-nav-item layadmin-flexible" lay-unselect>
                    <a href="javascript:" layadmin-event="flexible" title="侧边伸缩">
                        <i class="layui-icon layui-icon-shrink-right" id="LAY_app_flexible"></i>
                    </a>
                </li>
                <li class="layui-nav-item" lay-unselect>
                    <a href="javascript:" layadmin-event="refresh" title="刷新">
                        <i class="layui-icon layui-icon-refresh-3"></i>
                    </a>
                </li>
            </ul>

            <!-- 右侧 -->
            <ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right">
                <!--<li class="layui-nav-item" lay-unselect>
                    <a th:href="${session.OMS.value}" target="_blank">订单管理系统</a>
                </li>
                <li class="layui-nav-item" lay-unselect>
                    <a th:href="${session.UMS.value}" target="_blank">客户关系系统</a>
                </li>
                <li class="layui-nav-item" lay-unselect>
                    <a th:href="${session.SCM.value}" target="_blank">采购仓储系统</a>
                </li>
                <li class="layui-nav-item" lay-unselect>
                    <a th:href="${session.FICO.value}" target="_blank">财务管理系统</a>
                </li>
                <li class="layui-nav-item" lay-unselect>
                    <a th:href="${session.PLAT.value}" target="_blank">基础管理系统</a>
                </li>
                <li class="layui-nav-item" lay-unselect>
                    <a href="javascript:;">
                        其它系统
                    </a>
                    <dl class="layui-nav-child">
                        <dd><a th:href="${session.QY.value}" target="_blank">政企客户门户</a></dd>
                    </dl>
                </li>-->
<!--                <li class="layui-nav-item layui-hide-xs">
                    <a href="https://devops.xiujiadian.com/#/login" target="_blank" title="Devops">
                        <img src="/static/home/images/devops.png" style="width: 16px;height: 16px">
                    </a>
                </li>-->
                <li class="layui-nav-item" lay-unselect>
                    <a lay-href="msg/list.html" layadmin-event="message" lay-text="消息中心">
                        <i class="layui-icon layui-icon-notice"></i>
                        <span id="unReadMsgCount" class="layui-badge" style="top:30%!important;display: none"></span>
                    </a>
                </li>
                <!--<li class="layui-nav-item layui-hide-xs">
                    <a href="https://wms.xiujiadian.com" target="_blank" title="WMS仓储系统">
                        <img src="/static/home/images/WMS.png" style="width: 16px;height: 16px">
                        &lt;!&ndash;                        <i class="layui-icon layui-icon-home"></i>&ndash;&gt;
                    </a>
                </li>
                <li class="layui-nav-item" th:if="${#authPermit.checkMenuPermit('/agent/getCloudCallUrl.action')}"
                    id="ccsAgentLoginBtn">
                    <a href="javascript:openAgentLoginConfirm(this)" title="坐席登录">
                        <i class="layui-icon">
                            <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="16" height="16">
                                <path d="M797.994667 659.84c-26.666667 0-47.018667-19.925333-47.018667-45.952V388.693333c0-116.48-97.152-211.456-216.234667-211.456h-45.482666C370.218667 177.237333 273.066667 272.256 273.066667 388.693333v225.194667c0 26.026667-20.352 45.952-47.018667 45.952-26.624 0-47.018667-19.925333-47.018667-45.952V388.693333c0-166.997333 139.52-303.36 310.272-303.36h45.482667c170.794667 0 310.272 136.362667 310.272 303.36v225.194667c0 24.490667-20.394667 45.952-47.018667 45.952z"
                                      fill="#172B4D" p-id="1733"></path>
                                <path d="M226.005333 681.301333H89.685333C63.018667 681.301333 42.666667 661.333333 42.666667 635.306667V417.834667c0-26.026667 20.352-45.952 47.018666-45.952h136.32c26.666667 0 47.018667 19.882667 47.018667 45.952v217.514666c0 26.069333-21.930667 45.994667-47.018667 45.994667z m-89.301333-91.946666h42.282667V463.786667h-42.282667v125.610666zM934.314667 681.301333h-136.32c-26.666667 0-47.018667-19.925333-47.018667-45.994666V417.834667c0-26.026667 20.352-45.952 47.018667-45.952h136.32c26.666667 0 47.018667 19.882667 47.018666 45.952v217.514666c0 26.069333-21.930667 45.994667-47.018666 45.994667z m-89.301334-91.946666h42.282667V463.786667h-42.282667v125.610666zM511.232 938.666667c38.058667 0 68.949333-30.165333 68.949333-67.413334 0-37.205333-30.890667-67.413333-68.949333-67.413333-38.101333 0-68.949333 30.208-68.949333 67.413333 0 37.248 30.848 67.413333 68.949333 67.413334zM401.493333 508.16c24.277333 0 43.946667-19.2 43.946667-42.88 0-23.68-19.669333-42.922667-43.946667-42.922667-24.192 0-43.861333 19.2-43.861333 42.922667 0 23.68 19.626667 42.88 43.904 42.88zM620.928 508.16c24.192 0 43.861333-19.2 43.861333-42.88 0-23.68-19.626667-42.922667-43.861333-42.922667-24.234667 0-43.904 19.2-43.904 42.922667 0 23.68 19.626667 42.88 43.904 42.88z"
                                      fill="#172B4D" p-id="1734"></path>
                                <path d="M550.4 923.306667h-39.168c-26.666667 0-47.018667-19.882667-47.018667-45.909334 0-26.026667 20.352-45.994667 47.018667-45.994666h39.168c109.653333 0 200.576-87.296 200.576-196.096 0-26.026667 20.352-45.952 47.018667-45.952 26.624 0 47.018667 19.925333 47.018666 45.952 0 159.36-131.626667 288-294.613333 288z"
                                      fill="#172B4D" p-id="1735"></path>
                            </svg>
                        </i>
                    </a>
                </li>
                <li class="layui-nav-item layui-hide-xs"
                    th:if="${#authPermit.checkMenuPermit('/cms/*.action')}">
                    <a href="https://cms.xiujiadian.com" target="_blank" title="CMS系统">
                        <i class="layui-icon layui-icon-website"></i>
                    </a>
                </li>
                <li class="layui-nav-item layui-hide-xs" th:if="${#authPermit.checkMenuPermit('/bis/*.action')}">
                    <a th:href="${SYS_CUBE}" target="_blank" title="魔方系统">
                        <i class="layui-icon layui-icon-chart"></i>
                    </a>
                </li>-->

                <li class="layui-nav-item layui-hide-xs" lay-unselect>
                    <a href="javascript:" layadmin-event="theme">
                        <i class="layui-icon layui-icon-theme"></i>
                    </a>
                </li>
                <!--<li class="layui-nav-item layui-hide-xs" lay-unselect>
                    <a href="javascript:;" layadmin-event="note">
                        <i class="layui-icon layui-icon-note"></i>
                    </a>
                </li>-->
                <li class="layui-nav-item layui-hide-xs" lay-unselect>
                    <a href="javascript:" layadmin-event="fullscreen">
                        <i class="layui-icon layui-icon-screen-full"></i>
                    </a>
                </li>

                <li class="layui-nav-item" lay-unselect>
                    <a href="javascript:;">
                        <span class="welcome">外部平台&nbsp</span>
                    </a>
                    <dl class="layui-nav-child layui-anim layui-anim-upbit">
                        <dd>
                            <a href="https://devops.xiujiadian.com/#/login" target="_blank" title="Devops">
                                <img src="/static/home/images/devops.png" style="width: 16px;height: 16px">&nbspDevops
                            </a>
                        </dd>
                        <dd th:if="${#authPermit.checkMenuPermit('/agent/getCloudCallUrl.action')}" id="ccsAgentLoginBtn">
                            <a href="javascript:openAgentLoginConfirm(this)" title="坐席登录">
                                <i class="layui-icon">
                                    <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="16" height="16">
                                        <path d="M797.994667 659.84c-26.666667 0-47.018667-19.925333-47.018667-45.952V388.693333c0-116.48-97.152-211.456-216.234667-211.456h-45.482666C370.218667 177.237333 273.066667 272.256 273.066667 388.693333v225.194667c0 26.026667-20.352 45.952-47.018667 45.952-26.624 0-47.018667-19.925333-47.018667-45.952V388.693333c0-166.997333 139.52-303.36 310.272-303.36h45.482667c170.794667 0 310.272 136.362667 310.272 303.36v225.194667c0 24.490667-20.394667 45.952-47.018667 45.952z"
                                              fill="#172B4D" p-id="1733"></path>
                                        <path d="M226.005333 681.301333H89.685333C63.018667 681.301333 42.666667 661.333333 42.666667 635.306667V417.834667c0-26.026667 20.352-45.952 47.018666-45.952h136.32c26.666667 0 47.018667 19.882667 47.018667 45.952v217.514666c0 26.069333-21.930667 45.994667-47.018667 45.994667z m-89.301333-91.946666h42.282667V463.786667h-42.282667v125.610666zM934.314667 681.301333h-136.32c-26.666667 0-47.018667-19.925333-47.018667-45.994666V417.834667c0-26.026667 20.352-45.952 47.018667-45.952h136.32c26.666667 0 47.018667 19.882667 47.018666 45.952v217.514666c0 26.069333-21.930667 45.994667-47.018666 45.994667z m-89.301334-91.946666h42.282667V463.786667h-42.282667v125.610666zM511.232 938.666667c38.058667 0 68.949333-30.165333 68.949333-67.413334 0-37.205333-30.890667-67.413333-68.949333-67.413333-38.101333 0-68.949333 30.208-68.949333 67.413333 0 37.248 30.848 67.413333 68.949333 67.413334zM401.493333 508.16c24.277333 0 43.946667-19.2 43.946667-42.88 0-23.68-19.669333-42.922667-43.946667-42.922667-24.192 0-43.861333 19.2-43.861333 42.922667 0 23.68 19.626667 42.88 43.904 42.88zM620.928 508.16c24.192 0 43.861333-19.2 43.861333-42.88 0-23.68-19.626667-42.922667-43.861333-42.922667-24.234667 0-43.904 19.2-43.904 42.922667 0 23.68 19.626667 42.88 43.904 42.88z"
                                              fill="#172B4D" p-id="1734"></path>
                                        <path d="M550.4 923.306667h-39.168c-26.666667 0-47.018667-19.882667-47.018667-45.909334 0-26.026667 20.352-45.994667 47.018667-45.994666h39.168c109.653333 0 200.576-87.296 200.576-196.096 0-26.026667 20.352-45.952 47.018667-45.952 26.624 0 47.018667 19.925333 47.018666 45.952 0 159.36-131.626667 288-294.613333 288z"
                                              fill="#172B4D" p-id="1735"></path>
                                    </svg>
                                </i>坐席登录
                            </a>
                        </dd>
                        <dd>
                            <a href="https://wms.xiujiadian.com" target="_blank" title="WMS仓储系统">
                                <img src="/static/home/images/WMS.png" style="width: 16px;height: 16px">&nbspWMS仓储系统
                                <!--                        <i class="layui-icon layui-icon-home"></i>-->
                            </a>
                        </dd>
                        <dd th:if="${#authPermit.checkMenuPermit('/cms/*.action')}">
                            <a href="https://cms.xiujiadian.com" target="_blank" title="CMS系统">
                                <i class="layui-icon layui-icon-website"></i>&nbspCMS系统
                            </a>
                        </dd>
                        <dd th:if="${#authPermit.checkMenuPermit('/bis/*.action')}">
                            <a th:href="${SYS_CUBE2}" target="_blank" title="魔方系统">
                                <i class="layui-icon layui-icon-chart"></i>&nbsp魔方系统
                            </a>
                        </dd>
                    </dl>
                </li>

                <li class="layui-nav-item" lay-unselect>
                    <a href="javascript:;">
                        <span class="welcome">反馈&nbsp</span>
                    </a>
                    <dl class="layui-nav-child layui-anim layui-anim-upbit">
                        <dd><a href="javascript:openFeedback(1)">一键反馈</a></dd>
                        <dd><a href="javascript:openFeedback(2)">反馈列表</a></dd>
                    </dl>
                </li>

                <li class="layui-nav-item" lay-unselect>
                    <a href="javascript:">
                        <span class="welcome">工作快乐，<b>[[${staffName}]]</b> 同学</span>
                    </a>
                    <dl class="layui-nav-child layui-anim layui-anim-upbit">
                        <dd><a th:href="${updatePwd}" id="updatePassword">修改密码</a></dd>
                        <dd><a th:lay-href="|${session.MCC.value}/staff/staffsecuritylog/list.action|">安全日志</a></dd>
                        <dd><a th:href="${logoutUrl}">退出</a></dd>
                    </dl>
                </li>

                <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-unselect>
                    <a href="javascript:" layadmin-event="about"><i class="layui-icon layui-icon-more-vertical"></i></a>
                </li>
            </ul>
        </div>

        <!-- 侧边菜单 -->
        <div class="layui-side layui-side-menu">

            <div class="layui-side-scroll">
                <div class="layui-logo" th:src="${ZMN_URL_ENV}+'admin.xiujiadian.com/plat-frontend/#/homePage'">
                    <img style="min-width:45px; max-width: 45px;min-height: 45px;max-height: 45px;"
                         src="/static/home/images/logo_20201020_1.png"/>
                    <span>啄木鸟管理平台</span>
                </div>

                <!-- 页面菜单 -->
                <ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-menu"
                    lay-filter="layadmin-system-side-menu"
                    th:include="common/common :: menu"></ul>

            </div>
        </div>

        <!-- 页面标签 -->
        <div class="layadmin-pagetabs" id="LAY_app_tabs">
            <div class="layui-icon layadmin-tabs-control layui-icon-prev" layadmin-event="leftPage"></div>
            <div class="layui-icon layadmin-tabs-control layui-icon-next" layadmin-event="rightPage"></div>
            <div class="layui-icon layadmin-tabs-control layui-icon-down">
                <ul class="layui-nav layadmin-tabs-select" lay-filter="layadmin-pagetabs-nav">
                    <li class="layui-nav-item" lay-unselect>
                        <a href="javascript:"></a>
                        <dl class="layui-nav-child layui-anim-fadein">
                            <dd layadmin-event="closeThisTabs"><a href="javascript:">关闭当前标签页</a></dd>
                            <dd layadmin-event="closeOtherTabs"><a href="javascript:">关闭其它标签页</a></dd>
                            <dd layadmin-event="closeAllTabs"><a href="javascript:">关闭全部标签页</a></dd>
                        </dl>
                    </li>
                </ul>
            </div>
            <div class="layui-tab" lay-unauto lay-allowClose="true" lay-filter="layadmin-layout-tabs">
                <ul class="layui-tab-title" id="LAY_app_tabsheader">
                    <li lay-id="/console.action" th:src="${ZMN_URL_ENV}+'admin.xiujiadian.com/plat-frontend/#/homePage'" class="layui-this">
                        <i class="layui-icon layui-icon-home"></i>
                    </li>
                </ul>
            </div>
        </div>

        <!-- 主体内容 -->com.zmn.ccs.dubbo.interfaces.skillgroup.SkillGroupModifyRemoteService
        <div class="layui-body" id="LAY_app_body">
            <div class="layadmin-tabsbody-item layui-show">
                <!--                <iframe src="/plat-frontend/#/homePage" frameborder="0" class="layadmin-iframe"></iframe>-->
                <iframe th:src="${ZMN_URL_ENV}+'admin.xiujiadian.com/plat-frontend/#/homePage'" frameborder="0" class="layadmin-iframe"></iframe>
            </div>
        </div>

        <!-- 辅助元素，一般用于移动设备下遮罩 -->
        <div class="layadmin-body-shade" layadmin-event="shade"></div>

    </div>
</div>

<script type="text/javascript">
    window.currentInnerMsgIndex = null;
    layui.config({
        version: true,
        base: "/static/lay/"
    }).extend({
        index: "lib/index"
    }).use(['index', 'laytpl',], function () {
        //水印
        gwm.creation({
            txt: '[[${staffId}]]-[[${staffName}]]',
            alpha: 0.03
        })
        var waitTime = 5000;
        checkCookie();
        setInterval(checkCookie, waitTime);
    });
</script>

<script type="text/javascript">
    layui.config({
        version: true,
        base: "/static/lay/"
    }).extend({
        index: "lib/index",
        art_index_openTips: "/index/zmn.art.index.openTips",
    }).use(['index', 'art_index_openTips', 'laytpl',], function () {
        var laytpl = layui.laytpl;
        var $ = layui.$;
        $.get('/standard/record/listByUnReadAndStaffId.action', {}, function (resp) {
            resp.data.forEach(item => {
                item.createTime = zmnUtil.createTime(item.createTime);
                layer.open({
                    type: 2
                    , title: false //不显示标题栏
                    , closeBtn: 0
                    , shade: 0.3
                    , btn: ['我已阅读并同意按此规则执行']
                    , btnAlign: 'c'
                    , area: ['80%', '90%']
                    , moveType: 1 //拖拽模式，0或者1
                    , content: `/standard/record/preview.action?standardId=${item.standardId}`
                    , yes: function (index, layero) {
                        //do something
                        $.post('/standard/record/read.action', {standardId: item.standardId}, function (resp) {
                            if (resp.status == 200) {
                                layer.close(index); //如果设定了yes回调，需进行手工关闭
                            }
                        });
                    }
                });
            });
        });
    });
</script>


<script type="text/javascript">
    const ZMN_URL_ENV = "[[${ZMN_URL_ENV}]]"
    const staffId = [[${staffId}]]
    window.currentInnerMsgIndex = null;
    layui.config({
        version: true,
        base: "/static/lay/"
    }).extend({
        index: "lib/index"
    }).use(['index', 'laytpl',], function () {
        var waitTime = 300 * 1000;
        handleMsgCountAndRefreshLayer();
        setInterval(handleMsgCountAndRefreshLayer, waitTime);
    });
</script>

<script type="text/javascript">
    /**
     * 根据URL自动打开内容选项卡
     * @param hrefFieldName 匹配选项卡内容链接的url请求字段名称
     * @param titleFieldName 匹配选项卡标题的url请求字段名称
     */
    function autoOpenTabByUrl(hrefFieldName, titleFieldName) {
        let query = window.location.search.substr(1);
        let params = query.split('&');
        let newParams = [];
        for (let i = 0; i < params.length; i++) {
            let param = params[i];
            let hrefQuery = param.split('?');
            //包含？
            if (hrefQuery.length > 1) {
                for (let j = 0; j < hrefQuery.length; j++) {
                    newParams.push(hrefQuery[j]);
                }
            } else {
                newParams.push(param);
            }
        }
        let href = null;
        let title = null;
        let targetParams = [];
        for (let i = 0; i < newParams.length; i++) {
            let param = newParams[i];
            let pair = param.split('=');
            if (pair.length < 2) {
                continue;
            }
            if (pair[0] === titleFieldName) {
                title = pair[1];
            } else if (pair[0] === hrefFieldName) {
                href = pair[1];
            } else {
                targetParams.push(param);
            }
        }
        if (zmnUtil.isNotNull(href) && zmnUtil.isNotNull(title)) {
            title = decodeURI(title);
            if (targetParams.length > 0) {
                href = href + '?' + targetParams.join('&')
            }
            //执行跳转
            let topLayui = parent === self ? layui : top.layui;
            topLayui.index.openTabsPage(href, title);
        }
        return false;
    }
</script>

<script>
    function handleMsgCountAndRefreshLayer() {
        let countUrl = "/push/inner/waitReadMsgCount.action";
        var $ = layui.$;
        $.ajax({
            type: "POST", url: ZMN_URL_ENV + "gateway-api.xiujiadian.com/mcs/api/plat/countByQuery",
            contentType: "application/json",
            dataType: "json", data: JSON.stringify({
                body: {
                    query: {
                        objectId: `${staffId}`,
                        receiverType: 70,
                        messageType: 150,
                        readStatus: 1,
                    }
                },
            }),
            success: function (items) {
                if (items.status == 200) {
                    if (items.data == 0) {
                        $(top.window.document.body).find('#unReadMsgCount').hide();
                    } else if (items.data <= 99) {
                        $(top.window.document.body).find('#unReadMsgCount').text(items.data);
                        $(top.window.document.body).find('#unReadMsgCount').show();
                    } else {
                        $(top.window.document.body).find('#unReadMsgCount').text("99+");
                        $(top.window.document.body).find('#unReadMsgCount').show();
                    }

                    if (items.data > 0) {
                        let dataUrl = "/push/inner/listData.action";
                        $.ajax({
                            type: "POST", url: ZMN_URL_ENV + "gateway-api.xiujiadian.com/mcs/api/plat/listPageByQuery",
                            contentType: "application/json",
                            dataType: "json", data: JSON.stringify({
                                body: {
                                    query: {
                                        objectId: `${staffId}`,
                                        receiverType: 70,
                                        messageType: 150,
                                        readStatus: 1,
                                        pageIndex: 1,
                                        pageSize: 5,
                                    }
                                }
                            }),
                            success: function (response) {
                                if (response.status == 200) {
                                    if (response.data.items.length > 0) {
                                        $(".news-item").remove();
                                        let dataHtml = spliceData(response.data.items);
                                        $("#remindTip").append(dataHtml);
                                        if (window.currentInnerMsgIndex == null) {
                                            window.currentInnerMsgIndex = layer.open({
                                                type: 1
                                                , offset: 'rb'
                                                , title: '提醒'
                                                , closeBtn: 1
                                                , shade: 0
                                                , area: ['360px', '365px']
                                                , moveType: 1 //拖拽模式，0或者1
                                                , content: $('#innerMsgLayer')
                                                , cancel: function () {
                                                    // $.get('/push/inner/setMsgTemporaryStorage.action', {}, function () {
                                                    // });
                                                    layer.close(window.currentInnerMsgIndex);
                                                    window.currentInnerMsgIndex = null;
                                                }
                                            });
                                        }

                                    } else {
                                        layer.close(window.currentInnerMsgIndex);
                                        window.currentInnerMsgIndex = null;
                                    }
                                } else {
                                    layer.close(window.currentInnerMsgIndex);
                                    window.currentInnerMsgIndex = null;
                                }
                            }
                        });
                    } else {
                        layer.close(window.currentInnerMsgIndex);
                        window.currentInnerMsgIndex = null;
                    }
                }
            }
        });
    }
</script>

<script>
    function spliceData(items) {
        let dataHtml = "";
        for (var i = 0; i < items.length; i++) {
            let params = JSON.parse(items[i].params)
            let innerId = items[i].recordId;
            let linkUrl = params.url;
            let linkName = params.title;
            let content = items[i].content;
            let createTime = items[i].createTime;
            let realContent = content;
            if (content != null && content.length > 40) {
                realContent = realContent.substr(0, 39) + '... >>';
            }
            let createTimeStr = zmnUtil.createTime(createTime);
            dataHtml += '<div style="background-color: #f2f2f2;margin-left: -10px;margin-right: -10px" class="news-item">\n' +
                '                <div class="layui-form-item" style="margin-bottom: 0px !important; margin-left: 10px">\n' +
                '                    <label onclick="toLandingPage(\'' + innerId + '\', ' + '\'' + linkUrl + '\', \'' + linkName + '\')" style="font-weight: bold;cursor: pointer;">' + linkName + '</label>\n' +
                '                    <a onclick="loadRemind(\'' + innerId + '\');" class="layui-input-line-width" style="float: right;cursor: pointer;margin-bottom: 0px !important;">×</a>\n' +
                '                </div>\n' +
                '                <div class="layui-form-item" style="margin-bottom: 0px !important;margin-left: 10px">\n' +
                '                    <label style="cursor: pointer;" onclick="toLandingPage(\'' + innerId + '\', ' + '\'' + linkUrl + '\', \'' + linkName + '\')">' + realContent + '</label>\n' +
                '                    <div class="layui-input-line-width" style="float: right;margin-bottom: 0px !important;"\n' +
                '                     >' + createTimeStr + '</div>\n' +
                '                </div>\n' +
                '            </div>';
        }

        return dataHtml;
    }
</script>

<script>
    function toLandingPage(id, landingPage, title) {
        var $ = layui.$;
        let url = "/push/inner/read.action";
        $.ajax({
            type: "POST", url: ZMN_URL_ENV + "gateway-api.xiujiadian.com/mcs/api/plat/modifyRead",
            contentType: "application/json",
            dataType: "json", data: JSON.stringify({
                body: {
                    dio: {
                        objectId: `${staffId}`,
                        recordId: id
                    }
                }
            }),
            success: function (json) {
                if (json.status == 200) {
                    zmnLayUtil.openTabsPageCustom(parent, landingPage, title);
                    handleMsgCountAndRefreshLayer();
                } else {
                    layer.msg(json.message);
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
            }
        });
    }
</script>

<script>
    function loadRemind(id) {
        var $ = layui.$;
        let url = "/push/inner/read.action";
        $.ajax({
            type: "POST", url: ZMN_URL_ENV + "gateway-api.xiujiadian.com/mcs/api/plat/modifyRead",
            contentType: "application/json",
            dataType: "json", data: JSON.stringify({
                body: {
                    dio: {
                        objectId: `${staffId}`,
                        recordId: id
                    }
                }
            }),
            success: function (json) {
                if (json.status == 200) {
                    let dataUrl = "/push/inner/listData.action";
                    $.ajax({
                        type: "POST", url: ZMN_URL_ENV + "gateway-api.xiujiadian.com/mcs/api/plat/listPageByQuery",
                        contentType: "application/json",
                        dataType: "json", data: JSON.stringify({
                            body: {
                                query: {
                                    objectId: `${staffId}`,
                                    receiverType: 70,
                                    messageType: 150,
                                    readStatus: 1,
                                    pageIndex: 1,
                                    pageSize: 5,
                                }
                            }
                        }),
                        success: function (response) {
                            if (response.status == 200) {
                                if (response.data.items.length > 0) {
                                    $(".news-item").remove();
                                    let dataHtml = spliceData(response.data.items);
                                    $("#remindTip").append(dataHtml);
                                } else {
                                    layer.close(window.currentInnerMsgIndex);
                                    window.currentInnerMsgIndex = null;
                                }
                            }
                        }
                    });
                } else {
                    layer.msg(json.message);
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
            }
        });
    }
</script>

<script>
    function checkCookie() {
        var $ = layui.$;
        var endTime;
        var cookies = document.cookie;
        var index = cookies.indexOf("expire_flag=");
        var layIndex = null;
        var flag = localStorage.getItem("timeCount");
        if (flag == null || flag == undefined) {
            flag = "true";
        }
        if (index != -1) {
            index = index + 12;
            var endIndex = cookies.indexOf(";", index);
            if (endIndex == -1) {
                endIndex = cookies.length;
            }
            var value = cookies.substr(index, endIndex);
            if (value.indexOf("true") == -1 && layIndex != null) {
                var layer = layui.layer;
                layer.close(layIndex);
                if (localStorage.getItem("timeCount") == "false") {
                    localStorage.setItem("timeCount", "true");
                }
            } else if (flag == "true") {
                layui.use(['util', 'laydate', 'layer'], function () {
                    var layer = layui.layer;
                    var util = layui.util;
                    layIndex = layer.open({
                        type: 1,
                        content: $('#timeCount'),
                        title: "IP变化提醒",
                        area: ['600px', '250px'],
                        shade: 0,
                        id: "lay_timeout",
                        maxmin: true,
                        min: function (dom) {
                            layer.open({
                                type: 1,
                                content: $('#timeCount_rb'),
                                title: "IP变化提醒",
                                area: ['400px', '200px'],
                                shade: 0,
                                id: "lay_timeout1",
                                offset: 'rb',
                                success: function (layero, index) {
                                    var now = new Date();
                                    util.countdown(endTime, now, function (date, serverTime, timer) {
                                        var str = date[2] + '分' + date[3] + '秒';
                                        $('#time_rb').html(str);
                                    });
                                }
                            });
                            layer.close(layIndex);
                        },
                        success: function (layero, index) {
                            var now = new Date();
                            var endDate = new Date();
                            endDate.setMinutes(now.getMinutes() + 15);
                            endTime = endDate;
                            util.countdown(endDate, now, function (date, serverTime, timer) {
                                var str = date[2] + '分' + date[3] + '秒';
                                $('#time').html(str);
                            });
                        }
                    })
                });
                flag = "false";
                localStorage.setItem("timeCount", flag);
            }
        } else {
            localStorage.removeItem("timeCount");
        }
    }

</script>

<script th:inline="javascript">

    //const encrypt = [[${encrypt}]];
    var open_index;

    function openFeedback(that) {
        let $ = layui.$;
        $.ajax({
            type: "POST", url: '/feedback.action',
            dataType: "json", data: {},
            success: function (json) {
                console.log("反馈按钮:"+json);
                if (json!=null && json!="") {
                    openFeedbackFunc(that,json);
                } else {
                    layer.msg("请联系运维人员绑定钉钉ID", {"icon": 2});
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                console.log(textStatus)
            }
        });


        // if(encrypt!=null){
        //     openFeedbackFunc(that);
        // }else {
        //     layer.msg("该账户未绑定钉钉，请绑定后再操作", {"icon": 2});
        // }
    }

    function openFeedbackFunc(type,encrypt) {
        if (type==1){
                open_index=layer.open({
                type: 2
                , title: false //不显示标题栏
                , area: ['48%', '68%']
                , content: `https://itop.zmn.cn/encryptlogin/`+encrypt +`/orderadd?img=''`
                , end: function () {
                    //window.location.reload();
                }
            });
            window.addEventListener('message', handleMessage);
        }else if (type==2){

            let url2= `https://itop.zmn.cn/encryptlogin/`+encrypt +`/orderlist`;
            window.open(url2, "_blank");
            // layer.open({
            //     type: 2
            //     , title: false //不显示标题栏
            //     , area: ['80%', '65%']
            //     , content: `https://itop.zmn.cn/encryptlogin/`+encrypt +`/orderlist`
            //     , end: function () {
            //         //window.location.reload();
            //     }
            // });
        }
    }
    // 接收来自运维平台的域名
    const handleMessage = ({ origin }) => {
        debugger
        // 判断是否是来自运维平台的域名
        if (!origin.includes('itop.zmn.cn')) return;
        layer.close(open_index);
    };

</script>

<script th:inline="javascript">
    function openAgentLoginConfirm(that) {
        openAgentLogin(1);
    }

    function openAgentLogin(type) {
        console.log("type:"+type);
        let $ = layui.$;
        $.ajax({
            type: "GET",
            url: ZMN_URL_ENV + "ccb.xiujiadian.com/agent/getCloudCallUrl?type=" + type,
            xhrFields: {withCredentials: true}, //设置请求可以携带cookie
            crossDomain: true,
            success: function (res) {
                console.log(res)
                if (res.status != 200) {
                    layer.msg(res.message, {icon: 2});
                    return;
                }
                if (!res.data) {
                    layer.msg("访问受限", {icon: 2});
                    return;
                }
                // 本页跳转
                window.location.href = res.data;
            },
            error: function (XMLHttpRequest, status, errorThrown) {
                layer.msg("访问异常", {icon: 2});
            }
        });
    }

</script>
</body>
<div class="layui-fluid" id="updatePassTips" style="display: none">
    <form class="layui-form" action="" lay-filter="zmn-form-login">
        <div style="text-align: center;margin-top: 30px">
            提示！
        </div>
        <div style="text-align: center;margin-top: 40px;">
            <div>
                <div>系统检测您的密码为初始密码,为保证系统</div>
                <div>和数据安全，请修改密码！</div>
            </div>

        </div>
        <div style="text-align: center;margin-top: 60px">
            <button class="layui-btn" lay-submit id="query-submit" lay-filter="login-query-submit">修改密码</button>
        </div>
    </form>

</div>

<div class="layui-fluid" id="innerMsgLayer" style="background-color: white">
    <div class="layui-card" style="margin-top: -5px;margin-bottom: -5px">
        <div id="remindTip">
        </div>
    </div>
</div>

<div id="timeCount" style="width: 500px; height: 200px; display: none">

    <div style="width: 420px;margin-left: auto; margin-top: 30px ">
        <p>当前网络不在公司授权范围内，请开启VPN或者联系负责人认证当前网络，否则将在15分钟后，将禁止登录系统。</p>
        <p style="margin-top: 20px"><span>访问系统剩余时间：<span id="time" style="color: red"></span></span></p>
    </div>

</div>

<div id="timeCount_rb" style="width: 350px; height: 160px; display: none">
    <div style="width: 300px;margin-left: auto; margin-top: 20px ">
        <p>当前网络不在公司授权范围内，请开启VPN或者联系负责人认证当前网络，否则将在15分钟后，将禁止登录系统。</p>
        <p style="margin-top: 15px"><span>访问系统剩余时间：<span id="time_rb" style="color: red"></span></span></p>
    </div>

</div>

</html>


